import '../index.dart';

class CommonButton {
  /*常用的按钮样式 线条边框*/
  static Widget outlinedButton(BuildContext context,
      {required String text, VoidCallback? onPressed}) {
    return ConstrainedBox(
      constraints: const BoxConstraints.expand(height: 45.0),
      child: OutlinedButton(
        style: OutlinedButton.styleFrom(
          // padding: const EdgeInsets.all(14),
          side: BorderSide(
            width: 1,
            color: Theme.of(context).primaryColor,
          ),
        ),
        onPressed: onPressed,
        child: Text(
          text,
          style: Theme.of(context)
              .textTheme
              .titleMedium
              ?.copyWith(color: Theme.of(context).primaryColor),
        ),
      ),
    );
  }

  /*常用的按钮样式 主题色填充*/
  static Widget elevatedButton(BuildContext context,
      {required String text, VoidCallback? onPressed}) {
    return ConstrainedBox(
      constraints: const BoxConstraints.expand(height: 45.0),
      child: ElevatedButton(
        onPressed: onPressed,
        child: Text(
          text,
          style: Theme.of(context)
              .textTheme
              .titleMedium
              ?.copyWith(color: Colors.white),
        ),
      ),
    );
  }
}
